	INCLUDE 'FGRAPH.FI'
	INCLUDE 'FLIB.FI'

	Program QW03G

	INTEGER*2 Status      ! Return status

	INTEGER*2 I, J	      ! Loop variables
	INTEGER*2 MaxX, MaxY  ! Size of display area

	INTEGER*2 MainUnit    !	Base text handle


	INTEGER*2 MainHandle  ! Base graphics handle
	INTEGER*2 w1,w2,w3,w4 ! Child handles

	INCLUDE 'FGRAPH.FD'
	INCLUDE 'FLIB.FD'


	RECORD /XYCoord/   LastCoord

	RECORD /QWInfo/	   MyTextwin



C    Determine the Unit=* window handle and minimize it
      Status=InqFocusQQ(MainUnit)

      MyTextwin.Type= QWIN$Min

      Status=SetWSizeQQ(MainUnit,MyTextWin)


C    Determine base graphics window handle, and close it
      MainHandle=WGGetActiveQQ()

      Status = WGCloseQQ( MainHandle )


C    Set maximum values, based on VGA resolution
       MaxX = 639
       MaxY = 479


C    Open four display windows
	w1   = WGOpenQQ( 'Gfx 1'C )
	w2   = WGOpenQQ( 'Gfx 2'C )
	w3   = wGOpenQQ( 'Gfx 3'C )
	w4   = WGOpenQQ( 'Gfx 4'C )

C    Select the color for drawing
	  Status=SetColor($LightCyan)


C    Tile the default text and graphics child windows so
C    they can be read easier.
	 Status=ClickQQ( QWIN$Tile)


      DO I=1,4
       SELECT CASE (I)


      CASE(1)

C    Activate the window and set the video mode
	Status = WGSetActiveQQ( w1 )
	Status = SetVideoMode ($MaxColorMode)
C              Select the color for drawing
	Status = SetColor($LightCyan)
      DO J=0,MaxY,10
	CALL MoveTo ( 0, 0, LastCoord)
	Status=	LineTo (MaxX, J)
      END DO

      DO J=MaxX,0, -10
	CALL MoveTo( 0, 0, LastCoord)
	Status = LineTo( J, MaxY )
      END DO


      CASE (2)

C    Activate the window and set the video mode
	  Status = WGSetActiveQQ( w2 )

	  Status =  SetVideoMode ($MaxResMode)
C	 Select the color for drawing
	  Status =  SetColor($Yellow)
          DO J=0,MaxY,10
	      CALL MoveTo( MaxX, 0, LastCoord)
	      Status = LineTo ( 0, J )
          END DO
	  DO J=0,MaxX,10
	      CALL MoveTo ( MaxX, 0, LastCoord )
	      Status = LineTo(J, MaxY )
          END DO


      CASE (3)

C    Activate the window and set the video mode
	 Status = WGSetActiveQQ( w3)
	 Status = SetVideoMode ($VRes16Color)
C               Select the color for drawing

	  Status = SetColor($Brown)

      DO J=MaxY,0,-10

	 CALL MoveTo(MaxX, MaxY, LastCoord)
	 Status = LineTo(0, J)

      END DO

       DO J=0,MaxX,10

	CALL MoveTo( MaxX, MaxY, LastCoord)
	Status = LineTo(J, 0)

	END DO


      CASE (4)

C     Activate the window and set the video mode

      Status = WGSetActiveQQ( w4 )
      Status = SetvideoMode ($MRes256Color)

C     Select the color for drawing
      Status = SetColor($LightRed)

      DO J=0,MaxX,10
       CALL MoveTo (0, MaxY, LastCoord)
       Status = LineTo(J, 0)

      END DO

      DO J=0,MaxY,10

       CALL MoveTo( 0, MaxY, LastCoord)
       Status = LineTo( MaxX, J)

       END DO


	END SELECT

       END DO


       END
